Returns the number corresponding to the weekday represented by a serial date number that is generated by the DateSerial or the DateValue function.
DateSerial ないし DateValue 関数による日付データのシリアル変換値を基に、該当する曜日を示す数値を返します。
WeekDay (Number)
WeekDay (Number)
Integer
整数
Number: Integer expression that contains the serial date number that is used to calculate the day of the week (1-7).
Number: 曜日情報 (1-7) を得る日付データのシリアル変換値を示す数値表式。
The following example determines the day of the week using the WeekDay function when you enter a date.
下記の例では、プログラム実行日の曜日を WeekDay 関数を用いて表示させています。
Sub ExampleWeekDay
Sub ExampleWeekDay
Dim sDay As String
Dim sDay As String
REM Return and display the day of the week
REM 本日の曜日の取得と表示
Select Case WeekDay( Now )
Select Case WeekDay( Now )
case 1
case 1
sDay="Sunday"
sDay="Sunday"
case 2
case 2
sDay="Monday"
sDay="Monday"
case 3
case 3
sDay="Tuesday"
sDay="Tuesday"
case 4
case 4
sDay="Wednesday"
sDay="Wednesday"
case 5
case 5
sDay="Thursday"
sDay="Thursday"
case 6
case 6
sDay="Friday"
sDay="Friday"
case 7
case 7
sDay="Saturday"
sDay="Saturday"
End Select
End Select
msgbox "" + sDay,64,"Today is"
msgbox "" + sDay,64,"Today is"
End Sub
End Sub